package mjc.compiler;

import java.io.Serializable;

public class DTYPE implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	protected int taille;
	private DTYPE typeParent;

	public int getTaille() {
		return taille;
	}

	protected String nom;

	public String getNom() {
		return nom;
	}

	public DTYPE(String n, int t) {
		nom = n;
		taille = t;
		typeParent = null;
	}
	
	public DTYPE(String n, int t, DTYPE parent) {
		nom = n;
		taille = t;
		typeParent = parent;
	}

	public boolean compareTo(DTYPE autre) {
		boolean ok = false;
		ok = (nom.equals(autre.nom));
		if(!ok && typeParent != null) {
			ok = typeParent.compareTo(autre);
		}
		return ok;
	}

	public String toString() {
		return nom + "(" + taille + ")";
	}
}
